package com.lantosec.hmrp.modules.uploads.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.uploads.vo.SysUploadsVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 系统上传数据 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-02-19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysUploads extends BaseEntity<SysUploadsVO> {

    private static final long serialVersionUID = 1L;
    public SysUploads(SysUploadsVO vo){
        this.uploadId = vo.getUploadId();
        this.uploadTitle = vo.getUploadTitle();
        this.mediaType = vo.getMediaType();
        this.uploadTime = vo.getUploadTime();
        this.fileSize = vo.getFileSize();
        this.savePath = vo.getSavePath();
        this.fileName = vo.getFileName();
        this.fileSuffix = vo.getFileSuffix();
        this.thumbnailPath = vo.getThumbnailPath();
    }

    @Override
    public SysUploadsVO convertToVO(){
        return new SysUploadsVO(this);
    }


    /**
     * ID
     */
    @TableId(value = "upload_id", type = IdType.ASSIGN_UUID)
    private String uploadId;

    /**
     * 上传标题
     */
    private String uploadTitle;

    /**
     * 上传媒体类型(10图片 20文件)
     */
    private Integer mediaType;

    /**
     * 上传时间
     */
    private Date uploadTime;

    /**
     * 上传文件大小(KB)
     */
    private Long fileSize;

    /**
     * 文件保存路径
     */
    private String savePath;

    /**
     * 文件名
     */
    private String fileName;

    /**
     * 文件后缀名
     */
    private String fileSuffix;

    /**
     * 缩略图路径
     */
    private String thumbnailPath;

    public enum ColName {
        upload_id, upload_title, media_type, upload_time, file_size, save_path, file_name, file_suffix, 
    }
}
